using UnityEngine;

public class RecenterScroll : MonoBehaviour
{
	public MyCenterOnChild centerSript;

	private bool isDrag;

	private void Start()
	{
		if (centerSript == null)
		{
			centerSript = GetComponentInChildren<MyCenterOnChild>();
		}
	}

	private void OnPress(bool pressed)
	{
		if (!pressed)
		{
			if (centerSript != null && !isDrag)
			{
				centerSript.Recenter();
			}
			isDrag = false;
		}
	}

	private void OnDrag(Vector2 delta)
	{
		isDrag = true;
	}
}
